/**
*      author: Y_Yao
*      created: 2025-03-22 11:24:05
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 9e18;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 7;
int n;
unordered_map<string,int> sz;
unordered_map<string,string> fa;

string find(string x)
{
    return fa[x] == x ? x : fa[x] = find(fa[x]);
}

bool Union(string u,string v)
{
    u = find(u);
    v = find(v);
    if(u == v) return false;
    if(sz[u] > sz[v]) swap(u,v);
    fa[u] = v;
    sz[v] += sz[u];
    return true;
}

void solve()
{
    cin >> n;
    for(int i = 1;i <= n;i++)
    {
        string s1,t1;
        cin >> s1 >> t1;
        if(!fa.count(s1)) fa[s1] = s1;
        if(!fa.count(t1)) fa[t1] = t1;
        if(!Union(s1,t1))
        {
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}